package demo2;

/**
 *创建线程方式二，实现Runnable接口
 * */

class MyRannable implements Runnable{
    @Override
    public void run() {
        while (true) {
            System.out.println("hello runnable");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Thread thread=new Thread();
        thread.start();
        while(true){
            System.out.println("hello world");
            Thread.sleep(1000);
        }
    }
}
